package com.sky.controller.admin;

import com.sky.result.Result;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;

@RestController("adminShopController")
@RequestMapping("/admin/shop")
@Api(tags = "商铺管理")
@Slf4j
public class ShopController {
    private static final String key = "shop:status:";
    @Autowired
    private RedisTemplate redisTemplate;


    @PutMapping("{status}")
    public Result updateStatus(@PathVariable Integer status) {
        redisTemplate.opsForValue().set(key, status);
        return Result.success();
    }
    @GetMapping("status")
    public Result getStatus() {
        Integer o = (Integer) redisTemplate.opsForValue().get(key);
        return Result.success(o);
    }
}
